#include <string>
#include <iostream>
using namespace std;
class Pizza{
	private:
		string pizzaName;
	public:
		Pizza(){
			cout << " order Pizza." << endl;
		}
		void prepare(){
			cout << "prepare." << endl;
		}
		void bake(){
			cout << "bake." << endl;
		}	
		void cut(){
			cout << "cut." << endl;
		}		
		void box(){
			cout << "box." << endl;
		}		
};

class NYCheesePizza:public Pizza{
	public:
				NYCheesePizza(){
			cout << "order NYCheesePizza." << endl;
		}
	
};
class NYGreekPizza:public Pizza{
	public:
				NYGreekPizza(){
			cout << "order NYGreekPizza" << endl;
		}	
	
};
class NYPepperoniPizza:public Pizza{
	public:
				NYPepperoniPizza(){
			cout << " order NYPepperoniPizza" << endl;
		}		
};

class ChicagoCheesePizza:public Pizza{
	public:
				ChicagoCheesePizza(){
			cout << "order ChicagoCheesePizza." << endl;
		}
	
};
class ChicagoGreekPizza:public Pizza{
	public:
				 ChicagoGreekPizza(){
			cout << "order  ChicagoGreekPizza" << endl;
		}	
	
};
class  ChicagoPepperoniPizza:public Pizza{
	public:
				ChicagoPepperoniPizza(){
			cout << " order ChicagoPepperoniPizza" << endl;
		}		
};

class PizzaStore{
	public:
		Pizza * orderPizza(string type) {
			Pizza *pizza = NULL;
			pizza =createPizza(type);
			pizza->prepare();
			pizza->bake();
			pizza->cut();
			pizza->box();
			return pizza;
		}
	   virtual  Pizza * createPizza(string type) = 0;
};

class NYPizzaFactory:public PizzaStore{
	public:
		virtual Pizza * createPizza(string type){
			Pizza *pizza = NULL;
		     	if(type == "cheese"){
		     		pizza = new NYCheesePizza();
		     	}else if(type == "greek"){
		     		pizza = new NYGreekPizza();
		     	}else if(type == "pepperoni"){
		     		pizza = new NYPepperoniPizza();
		     	}	
			return pizza;			
		}
};

class  ChicagoPizzaFactory:public PizzaStore{
	public:
		virtual Pizza * createPizza(string type){
			Pizza *pizza = NULL;
		     	if(type == "cheese"){
		     		pizza = new  ChicagoCheesePizza();
		     	}else if(type == "greek"){
		     		pizza = new  ChicagoGreekPizza();
		     	}else if(type == "pepperoni"){
		     		pizza = new  ChicagoPepperoniPizza();
		     	}	
			return pizza;			
		}
};

class Product{
	
};

class MyProduct:public Product{
};

class YourProduct:public Product{
	
};


class Creator{
	public:
		virtual Product* Create(int type);	
};

Product* Creator::Create(int type){
	if(type == 1)
		return new MyProduct;
	else
		return new YourProduct;
}



int main(){
	PizzaStore *factory = new NYPizzaFactory();
	factory->orderPizza("cheese");
	delete factory;
	return 0;
}
